import SMERouter from 'sme-router';
const router = new SMERouter('router-view');

// 引入控制器
const homeController = require('../controller/home.js')
const positionController = require('../controller/position.js')
const positionAddController = require('../controller/positionAdd.js')
const positionUpdateController = require('../controller/positionUpdate.js');
const userSignupController = require('../controller/userSignup.js');
const userSigninController = require('../controller/userSignin.js');


// 路由局部刷新
router.route('/index', (req, res, next) => {
    homeController.render({ req, res, next });
});

router.route('/position', (req, res, next) => {
    positionController.render({ req, res, next, router });
});

router.route('/position_add', (req, res, next) => {
    positionAddController.render({ req, res, next, router });
});

router.route('/position_update', (req, res, next) => {
    positionUpdateController.render({ req, res, next, router });
});

router.route('/user/signup', (req, res, next) => {
    userSignupController.render({ req, res, next, router });
});

router.route('/user/signin', (req, res, next) => {
    userSigninController.render({ req, res, next, router });
});

router.route('*', (req, res, next) => {
    res.redirect('/index');
});